WITH inp as ( SELECT ST_Centroid(ST_Collect(ST_envelope(the_geom_webmercator))) as centroid,
                    ST_ConvexHull(ST_Collect(ST_Envelope(the_geom_webmercator))) as hull
 FROM table_name GROUP BY some_column)
SELECT ST_Buffer(centroid,
                ST_Length( ST_LongestLine(centroid, hull))) as the_geom_webmercator
FROM inp;